n = int(input())
a = list(map(int, input().split()))
Min = min(a)
Max = max(a)
a.remove(Min)
a.remove(Max)
print(sum(a) // (n - 2))